This page last changed on Mar 07, 2007 by desruisseaux.
This example shows you how to add a custom projection in Geoserver.
The projection parameters need to be provided as a WKT definition, so first thing is to write down a proper definition, such as:
PROJCS["NAD83 / Austin",
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980", 6378137.0, 298.257222101],
TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]],
PRIMEM["Greenwich", 0.0],
UNIT["degree", 0.017453292519943295],
AXIS["Lon", EAST],
AXIS["Lat", NORTH]],
PROJECTION["Lambert_Conformal_Conic_2SP"],
PARAMETER["central_meridian", -100.333333333333],
PARAMETER["latitude_of_origin", 29.6666666666667],
PARAMETER["standard_parallel_1", 31.883333333333297],
PARAMETER["false_easting", 2296583.333333],
PARAMETER["false_northing", 9842500.0],
PARAMETER["standard_parallel_2", 30.1166666666667],
UNIT["m", 1.0],
AXIS["x", EAST],
AXIS["y", NORTH],
AUTHORITY["EPSG","100002"]]
NOTE: the above has been formatted for readability, you'll have to provide it on single line instead, or put a backslash character at the end of every line except the last one.
- Go into your geoserver data directory, that will be referred as $datadir in the rest of the document. If you don't know where it is, have a look at the Geoserver logs, on start-up you'll see a big message reporting something like:
----------------------------------
- GEOSERVER_DATA_DIR: C:\progetti\geoserver\src\1.5.x\configuration\release
----------------------------------
- Go into the $datadir/user_projections folder, and open the epsg.properties file. If you don't have one, don't worry, create the $datadir/user_projection folder and then an empty text file name epsg.properties in it.
- Insert the above WKT (well known text) for the projection at the end of file (on a single line or with backslash characters, here it's formatted for readability):
100002=PROJCS["NAD83 / Austin", \
GEOGCS["NAD83", \
DATUM["North_American_Datum_1983", \
SPHEROID["GRS 1980", 6378137.0, 298.257222101], \
TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]], \
PRIMEM["Greenwich", 0.0], \
UNIT["degree", 0.017453292519943295], \
AXIS["Lon", EAST], \
AXIS["Lat", NORTH]], \
PROJECTION["Lambert_Conformal_Conic_2SP"], \
PARAMETER["central_meridian", -100.333333333333], \
PARAMETER["latitude_of_origin", 29.6666666666667], \
PARAMETER["standard_parallel_1", 31.883333333333297], \
PARAMETER["false_easting", 2296583.333333], \
PARAMETER["false_northing", 9842500.0], \
PARAMETER["standard_parallel_2", 30.1166666666667], \
UNIT["m", 1.0], \
AXIS["x", EAST], \
AXIS["y", NORTH], \
AUTHORITY["EPSG","100002"]]
- Save the file
- Restart geoserver
- Check the WKT has been properly parsed. You should see the newly-defined projection by going to http://localhost:8080/geoserver/srsHelp.do.
- If the projection wasn't listed, examine the console output for any errors related to parsing the WKT for your projection (the first time I insterted the WKT I had an extra comma):
tried to parse projection EPSG:100002 but couldnt!
Note the missing 's' at point 2:
"create the $datadir/user_projection folder" should read " create the $datadir/user_projections folder".
Miles

Posted by miles at Jun 21, 2007 00:55
|
|